﻿namespace Softserve.WcfServices.Logic
{
    using System;
    using Softserve.Pottery.Warehouse;
    using Softserve.Pottery.Warehouse.Contracts;
    using Softserve.Pottery.Warehouse.Domains;

    public class WarehouseLogic : IWarehouseScopeContract
    {
        public WarehouseLogic()
        {

        }

        public WarehouseLogic(IServiceProvider provider)
        {
            controller = (WarehouseController)provider.GetService(typeof(WarehouseController));
        }

        #region IAddressContract

        public Address CreateAdress(string country, string region, string city, string street, int m_ZipCode, string houseNumber, string m_ApartmentNumber = default(string), int
            m_Floor = default(int), string description = default(string))
        {
            return controller.CreateAdress(country, region, city, street, m_ZipCode, houseNumber, m_ApartmentNumber, m_Floor, description);
        }

        #endregion

        #region IWarehouseCatalogContract

        public void AddWarehouse(PotteryWarehouse item)
        {
            controller.AddWarehouse(item);
        }

        public void RemoveWarehouse(PotteryWarehouse item)
        {
            controller.RemoveWarehouse(item);
        }

        public void EditWarehouse(int productId, PotteryWarehouse item)
        {
            controller.EditWarehouse(productId, item);
        }

        #endregion

        #region IWarehouseContract

        public void CreateWarehouse(int id, string name, Address adress, int squareTotal, int squareFree, DateTime dateCreate)
        {
            controller.CreateWarehouse(id, name, adress, squareTotal, squareFree, dateCreate);
        }

        #endregion

        #region    Private

        private WarehouseController controller;

        #endregion

    }
}
